<template>
<div id="box">
    <div class="content" v-for="(list,index) in lists" :key="index" @click="go(index)">
        <div class="content-title">
            <img :src="list.img" alt="">
        </div>
        <div class="content-text">
                    <h2>
                        {{list.name}}
                    </h2>
                    <ul class="date">{{list.date}}</ul>
                    <ul class="showsite">{{list.address}}</ul>
                    <ul class="showitem">
                        <li>{{list.discount}}折起</li>
                        <li>可选座</li>
                    </ul>
                    <li class="price"><span>￥{{list.price}}</span>起</li>
                    <div class="recommend"><van-rate v-model="list.star" readonly size="6" color="#f98f45" /> <span>{{list.score}}</span></div>
        </div>
        <hr/>
    </div>
</div>
</template>
<script>
import axios from "axios";

export default {
  name: "AllShow",
  created() {
    axios({
      url: "/List",
      method: "get"
    }).then(res => {
      this.lists = res.data;
    });
  },
  data() {
    return {
      lists: []
    };
  },
  methods: {
    go(idx) {
      this.$router.push({
        path: "/Detail",
        query: { num: this.lists[idx].id }
      });
    }
  }
};
</script>

<style scoped>
#box {
  width: 3.27rem;
  margin: 0 auto;
  font-size: 0.15rem;
}
.content {
  display: flex;
  justify-content: space-around;
  margin-top: 0.2rem;
}
.content-title {
  float: left;
  width: 1.46rem;
  border: 1px solid #ccc;
  border-radius: 0.035rem;
  background-size: contain;
}
.content-title img {
  width: 100%;
  height: 100%;
}
.content-text {
  float: right;
  width: 2.8rem;
  height: 100%;
  position: relative;
  margin-left: 0.15rem;
}
.content-text h2 {
  font-size: 0.16rem;
}
.content-text ul {
  line-height: 0.23rem;
  font-size: 0.13rem;
  color: #9b9ba3;
}
.content-text .showtime {
  margin-top: 0.05rem;
}
.content-text .showitem {
  margin-top: 0.05rem;
  display: flex;
}
.content-text li {
  padding: 0.01rem 0.05rem;
  text-align: center;
  margin-right: 0.05rem;
  border-radius: 0.12rem;
  border: 1px solid #d6a473;
  color: #f09d4d;
}
.content-text .price {
  display: inline-block;
  border: none;
  width: 0.5rem;
  font-size: 0.085rem;
  color: #9c9ca4;
  margin-top: 0.05rem;
  margin-left: -0.1rem;
}
.price span {
  display: inline-block;
  font-size: 0.1rem;
  color: #ff2969;
}
.recommend {
  display: flex;
  position: absolute;
  right: 0.05rem;
  bottom: 0;
  font-size: 0.08rem;
}
.recommend span {
  margin-left: 0.08rem;
}
</style>
